package model.forview;

import java.util.ArrayList;

import model.wrap.type.Type;
import models.ConstantName;
import models.ConstantValue;

public class AllTypesModelForView extends ContentForMainTemplate
{
    protected ArrayList<Type> types;
    
    public AllTypesModelForView(ArrayList<Type> arrayOfTypes)
    {
	this.types = arrayOfTypes;	
	setDefaultValues();
    }
    
    public void setDefaultValues()
    {
	String title = ConstantValue
		.getConstantValue(ConstantName.TYPE_ALL_PAGE_TITLE);
	String header = ConstantValue
		.getConstantValue(ConstantName.TYPE_ALL_PAGE_HEADER);
	String footer = ConstantValue
		.getConstantValue(ConstantName.TYPE_ALL_PAGE_FOOTER);
	
	footer = footer != null ? footer : "Все типы данных";
	header = header != null ? header : "Все типы данных";
	title = title != null ? title : "Типы данных";
	String userName = "";

	mainModelForView = new MainModelForView(title, userName, header, footer);
    }
    
    public int getSize()
    {
	return this.types.size();
    }
    
    public String getTitle(int index)
    {
	return types.get(index).getTitle();
    }
    
    public String getDescription(int index)
    {
	return types.get(index).getDescription();
    }
    
    public long getId(int index)
    {
	return types.get(index).getID();
    }
}

